close;
interval = 10;
x = importdata('x.txt');
x1 = x(1:interval:end,1);
x2 = x(1:interval:end,2);
x3 = x(1:interval:end,3);
x4 = x(1:interval:end,4);

len = length(x);
avg_t = sum(x(:,5),1)/1788;

t = (1:interval:len)'*avg_t;

tiledlayout('flow');

nexttile([1 4]);
hold on
plot(t,x1);
plot(t,x2);
plot(t,x3);
plot(t,x4);
hold off
legend('电机一','电机二','电机三','电机四')
title('四电机同步速度曲线');
xlabel('时间')
ylabel('速度')

nexttile
plot(t,x1);
title('电机一速度控制曲线');
xlabel('时间')
ylabel('速度')

nexttile
plot(t,x2);
title('电机二速度控制曲线');
xlabel('时间')
ylabel('速度')

nexttile
plot(t,x3);
title('电机三速度控制曲线');
xlabel('时间')
ylabel('速度')

nexttile
plot(t,x4);
title('电机四速度控制曲线');
xlabel('时间')
ylabel('速度')
